package cn.study.luckyadapter.controller.admin;

import cn.study.common.annotation.ResponseResult;
import cn.study.luckyclient.api.IPrizeService;
import cn.study.luckyclient.dto.PrizeAddCmd;
import cn.study.luckyclient.dto.PrizeUpdateCmd;
import cn.study.luckyclient.dto.data.PrizeVo;
import cn.study.luckyclient.dto.query.PrizeListByParamQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@AllArgsConstructor
@ResponseResult
@RequestMapping("/admin/v1/prize")
public class AdminPrizeController {
    private final IPrizeService prizeService;
    @PostMapping("/add")
    public PrizeVo add(@RequestBody PrizeAddCmd cmd){
        return prizeService.add(cmd);
    }
    @PostMapping("/update")
    public PrizeVo update(@RequestBody PrizeUpdateCmd cmd){return prizeService.update(cmd);}
    @GetMapping("/page")
    public IPage<PrizeVo> page(@RequestBody PrizeListByParamQuery prizeListByParamQuery){
       return prizeService.page(prizeListByParamQuery);
    }
    @GetMapping("/{id}")
    public PrizeVo one(@PathVariable Long id){
       return prizeService.one(id);
    }
}
